package com.qf.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qf.mapper.DtsOrderMapper;
import com.qf.pojo.DtsOrder;
import com.qf.vo.CategorySellAmts;
import com.qf.vo.DayStatis;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author jiangjingbo
 * @version V1.0
 * @Project java2203
 * @Package com.qf.service
 * @Description:
 * @Date 2022/6/18 14:09
 */
@Service
public class OrderTotalServiceimpl implements OrderTotalService{
    /**
     * 查询订单数量
     * @return
     */
    @Autowired
    private DtsOrderMapper orderMapper;
    @Override
    public int OderTotalCount() {
        QueryWrapper<DtsOrder> queryWrapper =new QueryWrapper();
        queryWrapper.eq("deleted", false);
        Integer integer = orderMapper.selectCount(queryWrapper);
        return integer;
    }

    /**
     * 查询每日订单数量
     * @return
     */
    @Override
    public List<DayStatis> DayOderCount() {
        List<DayStatis> dayStatis = orderMapper.staticsIncresOrderCnt();
        return dayStatis;
    }

    /**
     * 日期和对应的订单总额, 订单笔数
     * @return
     */
    @Override
    public List<DayStatis> orderNumber() {
        System.out.println("=======");
        List<DayStatis> dayStatis = orderMapper.IncresOrdercnt();
        System.out.println("sql语句查询"+dayStatis);
        return dayStatis;
    }

    /**
     * 根据分类统计该分类下商品的销售额
     */
    @Override
    public List<CategorySellAmts> categoryCount() {
        List<CategorySellAmts> categorySellAmts = orderMapper.categorySell();
        return categorySellAmts;
    }

}
